package com.zy.explore.idempotent.infrastructure.config;

import com.zy.explore.idempotent.infrastructure.interceptor.IdempotentInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * description MVC配置
 *
 * @author 🇨🇳中国印🇨🇳
 * @date 2021年07月06日 21:13
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Resource
    private IdempotentInterceptor idempotentInterceptor;

    /**
     * 添加拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(idempotentInterceptor);
    }
}
